//
//  BillCell.m
//  OrderFood
//
//  Created by xiaofang wang on 2018/10/23.
//  Copyright © 2018年 zhiyuan. All rights reserved.
//

#import "BillCell.h"
@interface BillCell()
//@property(nonatomic,strong)UIView *topView;
//@property(nonatomic,strong)UILabel *orderNumLb;
//@property(nonatomic,strong)UILabel *moneyLb;
////
//@property(nonatomic,strong)UIImageView *quImg;
//@property(nonatomic,strong)UIImageView *songImg;
//@property(nonatomic,strong)UILabel *qh_storeLb;
//@property(nonatomic,strong)UILabel *qh_addressLb;
//@property(nonatomic,strong)UILabel *sh_addressLb;
//@property(nonatomic,strong)UILabel *sh_contactLb;
////
//@property(nonatomic,strong)UILabel *sendedtimeLb;
//@property(nonatomic,strong)UILabel *alreadyReceiveLb;
@end
@implementation BillCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.backgroundColor = WHITECOLOR;
        [self setupSubViews];
    }
    return self;
}

-(void)setupSubViews{
    self.topView  = [[UIView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 10)];
    self.topView.backgroundColor = BACKGROUNDCOLOR;
    [self.contentView addSubview:self.topView];
    
    self.orderNumLb = [[UILabel alloc] initWithFrame:CGRectMake(15, self.topView.mh_height, SCREEN_WIDTH-30-100-10, 40)];
    self.orderNumLb.font = FONT(14);
//    self.orderNumLb.text = [NSString stringWithFormat:@"%@%@",NSLocalizedString(@"orderNum", nil),@"201845212543"];
    [self.contentView addSubview:self.orderNumLb];
    
    
    
    self.moneyLb = [[UILabel alloc] initWithFrame:CGRectMake(self.orderNumLb.mh_right+10, self.topView.mh_height, 100, 40)];
    self.moneyLb.font = FONT(20);
//    self.moneyLb.text = @"￥9000.0";
    self.moneyLb.textColor = themeColor;
    self.moneyLb.textAlignment = NSTextAlignmentRight;
    [self.contentView addSubview:self.moneyLb];
    UIView *line = [QTTools tool_addLineWithFrame:CGRectMake(0, 50, SCREEN_WIDTH, 1) superView:self.contentView];
    
    self.quImg = [[UIImageView alloc] initWithFrame:CGRectMake(15, line.mh_y+30, 30, 30)];
    self.quImg.image = IMAGE(NSLocalizedString(@"qucan", nil));
    [self.contentView addSubview:self.quImg];
    
    self.qh_storeLb = [[UILabel alloc] initWithFrame:CGRectMake(self.quImg.mh_right+25, self.quImg.mh_top-5, SCREEN_WIDTH - 60-self.quImg.mh_width, 25)];
    self.qh_storeLb.font = FONT(15);
//    self.qh_storeLb.text = @"肯德基（火车站店)";
    [self.contentView addSubview:self.qh_storeLb];
    
    self.qh_addressLb = [[UILabel alloc] initWithFrame:CGRectMake(self.qh_storeLb.mh_left, self.qh_storeLb.mh_bottom, SCREEN_WIDTH - 60-self.quImg.mh_width, 20)];
    self.qh_addressLb.font = FONT(14);
    self.qh_addressLb.textColor = themeTextColor;
//    self.qh_addressLb.text = @"杭州火车东站售票厅西侧";
    [self.contentView addSubview:self.qh_addressLb];
    
    
    self.songImg = [[UIImageView alloc] initWithFrame:CGRectMake(15, self.quImg.mh_bottom+35, 30, 30)];
    self.songImg.image = IMAGE(NSLocalizedString(@"songcan", nil));
    [self.contentView addSubview:self.songImg];
    
    self.sh_addressLb = [[UILabel alloc] initWithFrame:CGRectMake(self.songImg.mh_right+25, self.songImg.mh_top-5, SCREEN_WIDTH - 60-self.songImg.mh_width, 25)];
    self.sh_addressLb.font = FONT(15);
//    self.sh_addressLb.text = @"西湖写字楼1栋158";
    [self.contentView addSubview:self.sh_addressLb];
    
    self.sh_contactLb = [[UILabel alloc] initWithFrame:CGRectMake(self.sh_addressLb.mh_left, self.sh_addressLb.mh_bottom, SCREEN_WIDTH - 60-self.songImg.mh_width, 20)];
    self.sh_contactLb.font = FONT(14);
    self.sh_contactLb.textColor = themeTextColor;
//    self.sh_contactLb.text = @"王二 先生 15123456789";
    [self.contentView addSubview:self.sh_contactLb];
    
    UIView *line2 = [QTTools tool_addLineWithFrame:CGRectMake(0, 210, SCREEN_WIDTH, 1) superView:self.contentView];
    
    self.sendedtimeLb = [[UILabel alloc] initWithFrame:CGRectMake(15, line2.bottom, (SCREEN_WIDTH-30)/2.0, 50)];
    self.sendedtimeLb.font = FONT(14);
    self.sendedtimeLb.text = @"12:58送达";
    [self.contentView addSubview:self.sendedtimeLb];
    
    self.alreadyReceiveLb = [[UILabel alloc] initWithFrame:CGRectMake(SCREEN_WIDTH/2.0 , line2.bottom, (SCREEN_WIDTH-30)/2.0, 50)];
    self.alreadyReceiveLb.font = FONT(14);
    self.alreadyReceiveLb.textAlignment = NSTextAlignmentRight;
//    self.alreadyReceiveLb.text = [NSString stringWithFormat:@"%@%@",NSLocalizedString(@"yishou", nil),@"￥38.0"];
    [self.contentView addSubview:self.alreadyReceiveLb];
    
}


-(void)setOrderModel:(OrderModel *)orderModel {
    self.moneyLb.text = [NSString stringWithFormat:@"¥ %@", orderModel.deliveryCommission];
    self.orderNumLb.text = [NSString stringWithFormat:@"%@%@",NSLocalizedString(@"orderNum", nil),orderModel.orderId];
    self.qh_storeLb.text = orderModel.shop.name;
    self.qh_addressLb.text = orderModel.shop.address;

    self.sh_addressLb.text = [NSString stringWithFormat:@"%@%@", orderModel.user.region, orderModel.user.detail];
    self.sh_contactLb.text = [NSString stringWithFormat:@"%@ %@ %@", orderModel.user.consignee, [orderModel.user.sex isEqualToString:@"1"]?@"女士":@"先生", orderModel.user.phone];
    self.alreadyReceiveLb.text = orderModel.receiveAmount.length==0||[orderModel.receiveAmount isEqualToString:@"0"]?@"":[NSString stringWithFormat:@"%@%@",NSLocalizedString(@"yishou", nil),orderModel.receiveAmount];
}



- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
